﻿@model WebUI.Models.QizSubjectDefine
@using (Ajax.BeginForm(new AjaxOptions()
{
    LoadingElementId = "OnLoadingSpan",
    UpdateTargetId = ViewBag.utid,
    InsertionMode = System.Web.Mvc.Ajax.InsertionMode.Replace,
    HttpMethod = "Post",
    OnSuccess = "$('#dialogbox').dialog('close');",
    OnFailure = "OnSiteError"
}))
{
    @Html.HiddenFor(model => model.ID)
    
    <fieldset class="big-input">
        <legend>移动网站相关设置</legend>
        @Html.EditorFor(m => m.IsAllowInMobile, "CheckField")
        @Html.EditorFor(m => m.ShortTitle, "TxtField")
        @Html.DisplayFor(m => Model.QizItem.Title)
    </fieldset>
    if (Model.QizItem.Type != "207")
    {
        <fieldset>
            <legend>关联指标: </legend>
            <h4 class="tip">
                只用关联指标选定指定的关联值时，当前问题才询问。</h4>
            <div class="editor-label">
                关联指标:
            </div>
            <div class="editor-field">
                <script type="text/javascript">
                    function reloadvalues(val) {
                        //if (val&&val!="") {
                        var requrl = '@(Url.Action("SftMingXiEnumTypeValus"))/';
                        $.ajax({
                            url: requrl + val
                    , success: function (data) { $('#enum_listview').html(data); }
                        });
                        //}
                    }

                </script>
                @Html.DropDownListFor(model => model.ParentSubjDefID, new SelectList((ViewBag.Selections as IEnumerable<QizSubjectDefine>).Select(v => new { ID = v.ID, Title = v.QizItem.Title }), "ID", "Title", Model.ParentSubjDefID), "--不关联--", new { onchange = "reloadvalues(this.value);" })
            </div>
            <div class="editor-label">
                关联选则:
            </div>
            <div class="editor-field" id="enum_listview">
                @if (string.IsNullOrEmpty(Model.ParentSubjDefID))
                {
                    <span>请先选择关联指标。</span>
                }
                else
                { 
                    @Html.Action("SftMingXiEnumTypeValus", new { ID = Model.ParentSubjDefID, srcID = Model.ID })
                }
            </div>
        </fieldset>
    
        <fieldset>
            <legend>自动诊断信息</legend>
            <div class="editor-label">
                自动诊断正常值范围[类型-@Model.QizItem.TypeRef.OptionTitle]:
            </div>
            <div class="editor-field">
                @if (Model.QizItem.TypeRef.OptionValue == "2")
                {
                    <text> 从：@Html.TextBoxFor(m => Model.ThresholdLow) 至：@Html.TextBoxFor(m => Model.ThresholdHight)
                    </text>
                }

                else if (Model.QizItem.TypeRef.OptionValue == "5" || Model.QizItem.TypeRef.OptionValue == "4")
                {

                    foreach (var item in Model.QizItem.EnumDefine.EnumValues)
                    {
                    <div>
                        @if (Model.ThresholdLow != null && Model.ThresholdLow.Contains(item.EnumValID))
                        {
                            <input type="checkbox" name="MulitSeletion" checked="checked" value="@item.EnumValID" />
                        }
                        else
                        {
                            <input type="checkbox" name="MulitSeletion" value="@item.EnumValID" />
                        }
                        @Html.Label(item.OptionTitle)
                    </div>  
                    }
                }
            </div>
            <div class="editor-label">
                异常常规建议:
            </div>
            <div>
                @Html.TextAreaFor(m => Model.YiChangTiXing, 5, 60, new { })
            </div>
        </fieldset>
    }
    <p>
        <input class="ui-button" type="submit" value="保存" />
    </p>
    
}